package com.bwie.doctorclient.mapper;

import com.bwie.doctorclient.domain.po.CommonlyDosagePO;
import com.bwie.doctorclient.domain.po.CommonlyPrescriptionPO;
import com.bwie.doctorclient.domain.vo.CommonlyDosageVO;
import com.bwie.doctorclient.domain.vo.CommonlyPrescriptionVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface PrescriptionMapper {
    /**
     * 根据医生id查询常用处方
     * @param doctorId
     * @return
     */
    List<CommonlyPrescriptionVO> getCommonlyPrescriptionByOrderId(@Param("doctorId") Long doctorId);

    /**
     * 查询常用处方下的常用药品用法用量
     * @param id
     * @return
     */
    List<CommonlyDosageVO> getDosageByPrescriptionId(Long id);

    /**
     * 根据常用处方id删除常用处方的药品用法用量信息
     * @param commonlyPrescriptionId
     */
    void delDosageByPrescriptionId(Long commonlyPrescriptionId);

    /**
     * 根据常用处方id删除常用处方药品用法用量中间表
     * @param commonlyPrescriptionId
     */
    void delDosageRelationByPrescriptionId(Long commonlyPrescriptionId);

    /**
     * 根据常用处方id删除常用处方
     * @param commonlyPrescriptionId
     */
    void delCommonlyPrescription(Long commonlyPrescriptionId);

    /**
     * 新增常用处方
     * @param commonlyPrescriptionPO
     */
    void addCommonlyPrescription(CommonlyPrescriptionPO commonlyPrescriptionPO);

    /**
     * 新增常用处方药品用法用量
     * @param commonlyDosagePO
     */
    void addDosage(CommonlyDosagePO commonlyDosagePO);

    /**
     * 新增常用处方药品用法用量中间表
     * @param commonlyPrescriptionId
     * @param commonlyDosageId
     */
    void addDosageRelation(@Param("commonlyPrescriptionId") Long commonlyPrescriptionId, @Param("commonlyDosageId") Long commonlyDosageId);

    /**
     * 根据id删除药品用法用量信息
     * @param commonlyDosageId
     */
    void delCommonlyDosage(Long commonlyDosageId);

    /**
     * 根据药品用法用量id删除常用处方药品用法用量中间表
     * @param commonlyDosageId
     */
    void delDosageRelationByDosageId(Long commonlyDosageId);

    /**
     * 编辑常用药品用法用量
     * @param commonlyDosagePO
     * @return
     */
    void updCommonlyDosage(CommonlyDosagePO commonlyDosagePO);

    /**
     * 编辑常用处方
     * @param commonlyPrescriptionPO
     * @return
     */
    void updateCommonlyPrescription(CommonlyPrescriptionPO commonlyPrescriptionPO);

}
